home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2002 #11
/
Amiga Plus CD - 2002 - No. 11.iso
/
amigaoscd
/
amigapluscd
/
AP-Website
/
news
/
admin
/
phpmyadmin
/
tbl_printview.php
< prev
next >
Wrap
PHP Script
|
2002-01-27
|
4KB
|
132 lines
<?php
/* $Id: tbl_printview.php,v 1.1 2000/04/05 07:43:03 tobias Exp $ */
if(!isset($message))
{
include("header.inc.php");
}
else
show_message($message);
unset($sql_query);
if(MYSQL_MAJOR_VERSION == "3.23")
{
$result = mysql_db_query($db, "SHOW TABLE STATUS LIKE '$table'") or mysql_die();
$row = mysql_fetch_array($result);
if(!empty($row["Comment"]))
{
echo "$strTableComments: $row[Comment]";
}
}
$result = mysql_db_query($db, "SHOW KEYS FROM $table") or mysql_die();
$primary = "";
while($row = mysql_fetch_array($result))
if ($row["Key_name"] == "PRIMARY")
$primary .= "$row[Column_name], ";
$result = mysql_db_query($db, "SHOW FIELDS FROM $table") or mysql_die();
?>
<table border=<?php echo $cfgBorder;?>>
<TR>
<TH><?php echo $strField; ?></TH>
<TH><?php echo $strType; ?></TH>
<TH><?php echo $strAttr; ?></TH>
<TH><?php echo $strNull; ?></TH>
<TH><?php echo $strDefault; ?></TH>
<TH><?php echo $strExtra; ?></TH>
</TR>
<?php
$i=0;
while($row= mysql_fetch_array($result))
{
$query = "server=$server&db=$db&table=$table&goto=tbl_properties.php";
$bgcolor = $cfgBgcolorOne;
$i % 2 ? 0: $bgcolor = $cfgBgcolorTwo;
$i++;
?>
<tr bgcolor="<?php echo $bgcolor;?>">
<td><?php echo $row["Field"];?> </td>
<td>
<?php
$Type = stripslashes($row["Type"]);
$Type = eregi_replace("BINARY", "", $Type);
$Type = eregi_replace("ZEROFILL", "", $Type);
$Type = eregi_replace("UNSIGNED", "", $Type);
echo $Type;
?> </td>
<td>
<?php
$binary = eregi("BINARY", $row["Type"], $test);
$unsigned = eregi("UNSIGNED", $row["Type"], $test);
$zerofill = eregi("ZEROFILL", $row["Type"], $test);
$strAttribute="";
if ($binary)
$strAttribute="BINARY";
if ($unsigned)
$strAttribute="UNSIGNED";
if ($zerofill)
$strAttribute="UNSIGNED ZEROFILL";
echo $strAttribute;
$strAttribute="";
?>
</td>
<td><?php if ($row["Null"] == "") { echo $strNo;} else {echo $strYes;}?> </td>
<td><?php if(isset($row["Default"])) echo $row["Default"];?> </td>
<td><?php echo $row["Extra"];?> </td>
</tr>
<?php
}
?>
</table>
<?php
$result = mysql_db_query($db, "SHOW KEYS FROM ".$table) or mysql_die();
if(mysql_num_rows($result)>0)
{
?>
<br>
<table border=<?php echo $cfgBorder;?>>
<tr>
<th><?php echo $strKeyname; ?></th>
<th><?php echo $strUnique; ?></th>
<th><?php echo $strField; ?></th>
</tr>
<?php
for($i=0 ; $i<mysql_num_rows($result); $i++)
{
$row = mysql_fetch_array($result);
echo "<tr>";
if($row["Key_name"] == "PRIMARY")
{
$sql_query = urlencode("ALTER TABLE ".$table." DROP PRIMARY KEY");
$zero_rows = urlencode($strPrimaryKey." ".$strHasBeenDropped);
}
else
{
$sql_query = urlencode("ALTER TABLE ".$table." DROP INDEX ".$row["Key_name"]);
$zero_rows = urlencode($strIndex." ".$row["Key_name"]." ".$strHasBeenDropped);
}
?>
<td><?php echo $row["Key_name"];?></td>
<td><?php
if($row["Non_unique"]=="0")
echo $strYes;
else
echo $strNo;
?></td>
<td><?php echo $row["Column_name"];?></td>
<?php
echo "</tr>";
}
print "</table>\n";
}
require ("footer.inc.php");
?>